﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:MessageControl"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"   
    mc:Ignorable="d"
    >
    <Style TargetType="local:MyMessage">
        <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/>
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeNormal}"/>
        <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
        <Setter Property="Background" Value="Snow"/>
        <Setter Property="Width" Value="480" />
        <Setter Property="Height" Value="800" />
        <!--定义模板的Template-->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:MyMessage">
                    <Grid VerticalAlignment="Stretch">
                        <Rectangle x:Name="backgroundRect" Grid.Row="0" Fill="Black" Opacity="0.7"/>
                        <Border 
                            VerticalAlignment="Top" 
                            BorderThickness="3" 
                            BorderBrush="Black">
                            <StackPanel Margin="0">
                                <ContentPresenter x:Name="body"/>
                            </StackPanel>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>